package com.yfq.springframework.beans.config;

import com.sun.istack.internal.Nullable;
import com.yfq.springframework.beans.BeansException;

/**
 * @author 姚凤桥
 * @date 2023/1/19 14:50
 * @description Bean的扩展机制，允许在对象创建前后对对象进行修改
 */
public interface BeanPostProcessor {
    /**
     * 在bean对象执行初始化方法之前执行
     */
    @Nullable
    default Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    /**
     * 在bean对象执行初始化方法之后执行
     */
    @Nullable
    default Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
}
